package org.wattdepot.cli.command;

import static org.junit.Assert.assertTrue;
import java.util.ArrayList;
import java.util.List;
import org.junit.Test;

/**
 * Test for Carbon Content.
 * 
 * @author Remy Baumgarten
 * @author Kevin Chiogioji
 * 
 */
public class TestCarbonContent {

  /**
   * Carbon content of the source.
   * 
   * @throws Exception -
   */
  @Test
  public void powerGeneratedWaste() throws Exception {
    CarbonContent content = new CarbonContent();
    List<String> args = new ArrayList<String>();
    args.add("SIM_KAHE");
    args.add("2009-10-26T12:00:00.000-10:00");
    args.add("10");
    System.out.println("CarbonContent Class:  Testing output for carbon content..");
    assertTrue("Checking carbon content for SIM_KAHE at 2009-10-26T12:00:00.000-10:00", content
        .doCommand(args).contains("1744 lbs CO2/MWh"));
  }

  /**
   * Test Input Validation 1.
   * 
   * @throws Exception -
   */
  @Test
  public void testInputValidation1() throws Exception {
    CarbonContent power = new CarbonContent();
    List<String> args = new ArrayList<String>();
    args.add("SIM_KAHE");
    args.add("2009-10-26T12.00.00.000-10.00");
    args.add("10");
    System.out.println("Checking input validation..." + power.doCommand(args));
    assertTrue("Checking input validation for ", power.doCommand(args).contains(
        "Invalid TimeStamp Formatting"));
  }

  /**
   * Test Input Validation 2.
   * 
   * @throws Exception -
   */
  @Test
  public void testInputValidation2() throws Exception {
    CarbonContent power = new CarbonContent();
    List<String> args = new ArrayList<String>();
    args.add("SIM_FAKE");
    args.add("2009-10-26T12:00:00.000-10:00");
    args.add("10");
    System.out.println("Checking input validation..." + power.doCommand(args));
    assertTrue("Checking input validation for ", power.doCommand(args).contains(
        "This resource is not available"));
  }

  /**
   * Test Input Validation 3.
   * 
   * @throws Exception -
   */
  @Test
  public void testInputValidation3() throws Exception {
    CarbonContent power = new CarbonContent();
    List<String> args = new ArrayList<String>();
    args.add("SIM_KAHE");
    args.add("2009-10-26T12:00:00.000-10:00");
    args.add("A");
    System.out.println("Checking input validation..." + power.doCommand(args));
    assertTrue("Checking input validation for ", power.doCommand(args).contains(
        "Your specified interval is not a number"));
  }

}
